package  {
 

	/**
	 * @author tkj
	 */
	public class MessageCenter implements IMessageCenter {
		private var mess : String = new String("message  from messageCenter");
		private  var bookers_arr : Array = new Array();

		public function MessageCenter() {
		}

		public function addBook(bo : Booker) : void {
			if (bookers_arr.indexOf(bo) < 0) {
				bookers_arr.push(bo);
			}
			;
		}

		public function removeBook(bo : Booker) : void {
			var b_index : int = bookers_arr.indexOf(bo);
			if(b_index >= 0) {
				bookers_arr.splice(b_index, 1);
			}
		}

		public function send() : void {
			var bookers_len : Number = bookers_arr.length;
			for(var i : Number = 0;i < bookers_len;i++) {
				bookers_arr[i].update(mess);
			}
		}
	}
}
